<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{{ url_for('static',filename='layui/css/layui.css') }}">
</head>
<body>
<div class="layui-breadcrumb">
    <a href="welcome">首页</a>
    <a href="addUnivInfo" class="layui-this">添加大学信息</a>
</div>
<center>
    <span style="font-size: 30px" class="layui-col-lg-offset4  layui-bg-red">添加大学信息</span>
</center>
<form id="f1" class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">中文名称</label>
        <div class="layui-input-inline">
            <input id="univCnname" type="text" name="univCnname" required lay-verify="required"
                   placeholder="请输入中文名称" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">英文名称</label>
        <div class="layui-input-inline">
            <input id="univEnname" type="text" name="univEnname" required lay-verify="required"
                   placeholder="请输入英文名称" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">大学标签</label>
        <div class="layui-input-inline">
            <select id="univTags" name="univTags" lay-verify="required">
                <option value=""></option>
                <option value="一流大学A类" selected>一流大学A类</option>
                <option value="一流大学B类">一流大学B类</option>
                <option value="一流学科">一流学科</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="btn_saveData" onclick="addUnivInfo()">保存数据</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</div>
<script src="{{ url_for('static',filename='jquery/jquery-3.5.1.min.js') }}"></script>
<script src="{{ url_for('static',filename='layui/layui.js') }}"></script>
<script>
    layui.use(['element', "util"], function () {
        var element = layui.element;
    });

    function addUnivInfo() {
        var formData = $("#f1").serialize()
        $.ajax({
            url: "addUnivInfoData"
            data: formData,
            method: "get",
            success: function (result) {
                if (result == "1")
                    window.location.href = "univList"
            }, error: function (e) {
                layer.msg("请求服务器失败!")
            }
        });
    }
</script>
</body>
</html>